ATOM Documentation

← Back to App

Integration Credentials Guide

This guide explains how to configure credentials for 600+ integrations in ATOM SaaS.

šŸ”‘ Credential Architecture

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│                     ATOM SaaS Platform                       │
ā”œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¤
│  .env (Platform-Level)          │  Database (Tenant-Level)  │
│  ─────────────────────          │  ──────────────────────── │
│  OAuth App IDs/Secrets          │  User OAuth Tokens        │
│  Platform API Keys              │  BYOK API Keys (OpenAI)   │
│  Stripe/SendGrid Keys           │  Integration Connections  │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜

šŸ“„ Push vs Pull Data Sync

Which Apps Require Scheduled Pulling?

**~40% of integrations require scheduled polling** because they don't offer webhooks or have limited real-time capabilities.

IntegrationSync TypeDetails
**Slack**āœ… PUSHReal-time Events API - instant
**Shopify**āœ… PUSHWebhooks for orders, products, customers
**HubSpot**āœ… PUSHWebhook subscriptions for all CRM events
**Salesforce**āœ… PUSHStreaming API + Outbound Messages
**Stripe**āœ… PUSHWebhooks for payments, subscriptions
**GitHub**āœ… PUSHWebhooks for commits, PRs, issues
**Jira**āœ… PUSHWebhooks for issue changes
**Linear**āœ… PUSHWebhooks available
**Gmail**āš ļø HYBRIDPush notifications for new mail + pull for history
**Outlook**āš ļø HYBRIDChange notifications expire, need re-subscribe
**Google Calendar**āš ļø HYBRIDPush notifications + pull for full sync
**Airtable**āš ļø HYBRIDWebhooks only on paid plans; free = poll
**MS Teams**āš ļø HYBRIDSubscriptions expire after 60 min
**QuickBooks**āŒ PULLNo webhooks - must poll Change Data Capture API
**Xero**āŒ PULLVery limited webhooks - mostly polling
**Notion**āŒ PULL**No webhooks at all** - polling only
**Zoho CRM**āŒ PULLWebhooks unreliable - recommend polling
**Monday.com**āŒ PULLWebhooks are premium feature
**Dropbox**āš ļø HYBRIDWebhooks for file changes, polling for details
**Box**āœ… PUSHWebhooks for all events

Real-Time vs Scheduled Sync (Tier-Based)

Your SyncOrchestrator handles polling automatically based on subscription tier:

// From src/lib/sync/orchestrator.ts
SYNC_INTERVALS = {
  FREE:       'WEEKLY',      // Every 7 days (poll-only apps)
  SOLO:       'DAILY',       // Every 24 hours  
  TEAM:       'HOURLY',      // Every hour
  ENTERPRISE: 'REAL_TIME'    // Webhook-first, poll as backup
}

---

šŸ› ļø Platform Credentials (.env)

These are YOUR OAuth app credentials (not customer's).

Required for Core Features

# ═══════════════════════════════════════════════════════════
#                    CORE PLATFORM
# ═══════════════════════════════════════════════════════════

DATABASE_URL="postgresql://user:pass@host:5432/atom_saas?sslmode=require"
REDIS_URL="redis://user:pass@host:6379"

JWT_SECRET="generate-with-openssl-rand-base64-32"
NEXTAUTH_URL="https://app.atom-saas.com"
NEXTAUTH_SECRET="generate-with-openssl-rand-base64-32"

# ═══════════════════════════════════════════════════════════
#                    BILLING & EMAIL
# ═══════════════════════════════════════════════════════════

STRIPE_SECRET_KEY="sk_live_..."
STRIPE_PUBLISHABLE_KEY="pk_live_..."
STRIPE_WEBHOOK_SECRET="whsec_..."
STRIPE_PRICE_ID_SOLO="price_..."
STRIPE_PRICE_ID_TEAM="price_..."
STRIPE_PRICE_ID_ENTERPRISE="price_..."

SMTP_HOST="smtp.sendgrid.net"
SMTP_USER="apikey"
SMTP_PASS="SG...."
FROM_EMAIL="noreply@atom-saas.com"

CRM Integrations

# ═══════════════════════════════════════════════════════════
#                    SALESFORCE
# ═══════════════════════════════════════════════════════════
# Create app: Setup → Apps → App Manager → New Connected App
SALESFORCE_CLIENT_ID="3MVG9..."
SALESFORCE_CLIENT_SECRET="..."
SALESFORCE_CALLBACK_URL="https://app.atom-saas.com/api/integrations/salesforce/callback"

# ═══════════════════════════════════════════════════════════
#                    HUBSPOT
# ═══════════════════════════════════════════════════════════
# Create app: https://developers.hubspot.com/
HUBSPOT_CLIENT_ID="..."
HUBSPOT_CLIENT_SECRET="..."
HUBSPOT_CALLBACK_URL="https://app.atom-saas.com/api/integrations/hubspot/callback"

# ═══════════════════════════════════════════════════════════
#                    ZOHO
# ═══════════════════════════════════════════════════════════
# Create app: https://api-console.zoho.com/
ZOHO_CLIENT_ID="..."
ZOHO_CLIENT_SECRET="..."
ZOHO_CALLBACK_URL="https://app.atom-saas.com/api/integrations/zoho/callback"

Communication Integrations

# ═══════════════════════════════════════════════════════════
#                    SLACK
# ═══════════════════════════════════════════════════════════
# Create app: https://api.slack.com/apps
SLACK_CLIENT_ID="..."
SLACK_CLIENT_SECRET="..."
SLACK_SIGNING_SECRET="..."
SLACK_CALLBACK_URL="https://app.atom-saas.com/api/integrations/slack/callback"

# ═══════════════════════════════════════════════════════════
#                    GOOGLE (Gmail, Calendar, Drive)
# ═══════════════════════════════════════════════════════════
# Create app: https://console.cloud.google.com/
GOOGLE_CLIENT_ID="...apps.googleusercontent.com"
GOOGLE_CLIENT_SECRET="..."
GOOGLE_CALLBACK_URL="https://app.atom-saas.com/api/integrations/callback"

# ═══════════════════════════════════════════════════════════
#                    MICROSOFT (Outlook, Teams, OneDrive)
# ═══════════════════════════════════════════════════════════
# Create app: https://portal.azure.com/ → App registrations
MICROSOFT_CLIENT_ID="..."
MICROSOFT_CLIENT_SECRET="..."
MICROSOFT_TENANT_ID="common"
MICROSOFT_CALLBACK_URL="https://app.atom-saas.com/api/integrations/callback"

E-commerce & Finance

# ═══════════════════════════════════════════════════════════
#                    SHOPIFY
# ═══════════════════════════════════════════════════════════
# Create app: https://partners.shopify.com/
SHOPIFY_API_KEY="..."
SHOPIFY_API_SECRET="..."
SHOPIFY_SCOPES="read_products,write_orders,read_customers"

# ═══════════════════════════════════════════════════════════
#                    QUICKBOOKS
# ═══════════════════════════════════════════════════════════
# Create app: https://developer.intuit.com/
QUICKBOOKS_CLIENT_ID="..."
QUICKBOOKS_CLIENT_SECRET="..."
QUICKBOOKS_CALLBACK_URL="https://app.atom-saas.com/api/integrations/callback"

# ═══════════════════════════════════════════════════════════
#                    XERO
# ═══════════════════════════════════════════════════════════
# Create app: https://developer.xero.com/
XERO_CLIENT_ID="..."
XERO_CLIENT_SECRET="..."
XERO_CALLBACK_URL="https://app.atom-saas.com/api/integrations/callback"

---

šŸ—„ļø Tenant Credentials (Database)

When a user connects an integration, tokens are stored in tenant_settings:

-- Example: User connects their Salesforce account
INSERT INTO tenant_settings (tenant_id, setting_key, setting_value, encrypted)
VALUES (
  'tenant-uuid',
  'salesforce_tokens',
  '{"access_token": "...", "refresh_token": "...", "instance_url": "..."}',
  true
);

-- BYOK: User provides their own OpenAI key
INSERT INTO tenant_settings (tenant_id, setting_key, setting_value, encrypted)
VALUES (
  'tenant-uuid',
  'OPENAI_API_KEY',
  'sk-proj-...',
  true
);

Token Refresh Flow

// Automatic token refresh (simplified)
async function refreshTokenIfNeeded(tenantId: string, integration: string) {
  const settings = await getTenantSettings(tenantId);
  const tokens = JSON.parse(settings[`${integration}_tokens`]);
  
  if (isExpired(tokens.expires_at)) {
    const newTokens = await oauthClient.refreshToken(tokens.refresh_token);
    await saveTenantSetting(tenantId, `${integration}_tokens`, newTokens);
    return newTokens;
  }
  return tokens;
}

---

šŸ“‹ Quick Setup Checklist

Minimum Viable Production

  • [ ] DATABASE_URL - PostgreSQL with SSL
  • [ ] REDIS_URL - For rate limiting & caching
  • [ ] JWT_SECRET / NEXTAUTH_SECRET - Generate secure secrets
  • [ ] STRIPE_* - For billing
  • [ ] SMTP_* - For transactional emails

Top 5 Integrations to Enable First

  1. [ ] **Slack** - Team communication (PUSH)
  2. [ ] **Google** - Gmail, Calendar, Drive (PULL + webhooks)
  3. [ ] **Salesforce** - CRM (PUSH + PULL)
  4. [ ] **Shopify** - E-commerce (PUSH via webhooks)
  5. [ ] **QuickBooks** - Finance (PULL)

---

šŸ”’ Security Best Practices

  1. **Never commit real credentials** - Use .env files (gitignored)
  2. **Encrypt tokens in database** - Use encrypted: true column
  3. **Rotate secrets regularly** - Especially after team changes
  4. **Use least-privilege scopes** - Only request what you need
  5. **Monitor OAuth activity** - Log all token refreshes